package com.Apolar_sh;

import com.gem.CrmApplication;
import com.gem.domain.CCooperationResult;
import com.gem.domain.CDailySpending;
import com.gem.service.CCooperationResultService;
import com.gem.service.CDailySpendingService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.Date;

/**
 * @Author: Apolar_sh
 * @Description: 插入模拟数据
 * @create 2019/10/21 20:29
 * @Modified By:
 */
@RunWith(SpringRunner.class)
@SpringBootTest(classes = CrmApplication.class)
public class DataBaseUtil {

    @Autowired
    private CDailySpendingService cDailySpendingService;

    @Autowired
    private CCooperationResultService cCooperationResultService;

    //插入日常经费模拟数据
    @Test
    public void insertDSData() {
        CDailySpending cDailySpending = new CDailySpending();
        for (int i = 1; i < 101; i++) {
            cDailySpending.setDsDate(new Date());
            cDailySpending.setDsEntertainLeader(100.0 + i);
            cDailySpending.setDsEntertainStu(100.0 + i);
            cDailySpending.setDsOther(100.0 + i);
            cDailySpending.setDsOtherState("说明" + i);
            cDailySpending.setDsRemark("备注" + i);
            cDailySpending.setDsSellerUid(43);
            cDailySpending.setDsServices(100.0 + i);
            cDailySpending.setDsStayCount(i);
            cDailySpending.setDsStayPeople("王" + i + ",李" + i);
            cDailySpending.setDsStayTotalprice(500.0 + i);
            cDailySpending.setDsStayUnitprice(100.0 + i);
            cDailySpending.setDsTotal(1000.0 + i);
            cDailySpending.setDsTrafficOther(100.0 + i);
            cDailySpending.setDsTrafficTaxi(100.0 + i);
            cDailySpending.setDsTrafficTotal(100.0 + i);
            cDailySpendingService.addDSService(cDailySpending);
        }
        System.out.print("完成：100%");
    }

    //插入合作成果模拟数据
//    @Test
//    public void insertCRData() {
//        CCooperationResult cCooperationResult = new CCooperationResult();
//        for (int i = 1; i < 101; i++) {
//            cCooperationResult.setCrDate(new Date());
//            cCooperationResult.setCrType("Python");
//            cCooperationResult.setCrTopic("外包");
//            cCooperationResult.setCrTopicRequire("优秀" + i);
//            cCooperationResult.setCrTopicUnitprice(100 + i);
//            cCooperationResult.setCrTopicTotalprice(1000 + i);
//            cCooperationResult.setCrCourseTeacher("薛老师" + i);
//            cCooperationResult.setCrCourseGrade("5");
//            cCooperationResult.setCrCourseEvaluation("赞！");
//            cCooperationResult.setCrMember("Apolar_sh" + i);
//            cCooperationResult.setCrMemberCount(i);
//            cCooperationResult.setCrSales("张" + i);
//            cCooperationResult.setCrRemark("备注" + i);
//            cCooperationResultService.addCRService(cCooperationResult);
//        }
//        System.out.print("完成：100%");
//    }
}
